<?php
class ArticlePage extends Page {
    
    static $db = array(
        'Date' => 'Date',
        'ShowAsPage' => 'Boolean'
    );
    
    static $has_one = array(
        'Photo' => 'Image'
    );
    
    static $icon = 'themes/default/images/icons/newspage';
    
    static $allowed_children = "none";
 
    static $default_parent = "ArticleHolder";
 
    static $can_be_root = false;
    
    function getCMSFields() {
        $fields = parent::getCMSFields();
        $fields->removeFieldFromTab("Root.Content.Main", "Image");
         
        $fields->addFieldToTab('Root.Content.Main', $dateField = new DateField('Date','Datum'), 'Content');
        $dateField->setConfig('showcalendar', true);
        $dateField->setConfig('dateformat', 'dd/MM/YYYY');
        
        $fields->addFieldToTab("Root.Content.Main", new CheckboxField('ShowAsPage', 'Dit artikel als pagina weergeven (i.p.v. uitschuiven)'), 'Content');
        $fields->addFieldToTab("Root.Content.Main", new ImageField('Photo', 'Afbeelding'), 'ShowBreadcrumbs');
        return $fields;
    }
}
 
class ArticlePage_Controller extends Page_Controller {
     
    public function init() {
	parent::init();
    }
}
